package project_structure;

/**
 * @Author quan
 * @Description 用while求阶乘的和
 * @Date 2023/1/14 12:07
 */
public class whileSum
{
    public static void main(String[] args) {
        //1-5的阶乘的和，使用while循环实现
        int i = 1;
        int res = 1;
        int sum = 0;
        while(i<=5){
            res*=i;
            sum+=res;
            i++;
         }
        System.out.println(sum);
    }
}
